/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package types;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
import types.RequestXML.Params.Param;

/**
 *
 * @author efim
 */
@XmlRootElement(name="request")
public class RequestXML {

    public RequestXML() {
        params = new Params();
    }
    
    private String method;
    
    @XmlElement(name="method")
    public void setMethod(String method) {
        this.method = method;
    }
    
    public String getMethod()
    {
        return method;
    }
   
    
    private Params params;

    public Params getParams() {
        return params;
    }
    @XmlElement(name="params")
    public void setParams(Params params)
    {
        this.params = params;
    }
    
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlRootElement(name="param")
    public static class Params
    {

        public Params() 
        {
            param = new LinkedList<>();
        }        
        
        private List<Param> param;

        public List<Param> getValues() 
        {
            return param;
        }
        
        public void addParam(Param  p)
        {
            param.add(p);
        }
        
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlRootElement(name = "param")
        public static class Param {

            public Param(String name, String value) {
                this.name = name;
                this.value = value;
            }

            public Param() {
            }
            

            @XmlAttribute(name = "name")
            private String name;

            public String getName() {
                return name;
            }

            public String getValue() {
                return value;
            }

            @XmlValue
            private String value;

        }
        
    }
    
    
    
}
